package com.example.covid19.mapper;

import com.example.covid19.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author BaiZhengChun
 * @since 2022-09-12
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT " +
            "user_discount.discount, " +
            "`user`.`password`, " +
            "`user`.phone, " +
            "`user`.major, " +
            "`user`.classs, " +
            "`user`.username, " +
            "user_discount.studentid" +
            " FROM " +
            "`user`" +
            " INNER JOIN " +
            "user_discount" +
            " ON " +
            "`user`.studentid = user_discount.studentid" +
            " WHERE  " +
            "`user`.studentid = #{userid} AND " +
            "user_discount.studentid = `user`.studentid")
    Object userinfo(@Param("userid") Integer userid);
    @Select("SELECT " +
            " `user`.* " +
            "FROM " +
            " `user` " +
            "LIMIT #{pageNo}, #{pagesize}")
    List<User> userinf(@Param("pageNo")Integer pageNo,@Param("pagesize")Integer pagesize);

}
